<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html lang="en">

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  <title>LCOV - ged.info - smart_ptr/shared_ptr.hpp</title>
  <link rel="stylesheet" type="text/css" href="../gcov.css">
</head>

<body>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
    <tr><td class="title">LTP GCOV extension - code coverage report</td></tr>
    <tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>

    <tr>
      <td width="100%">
        <table cellpadding=1 border=0 width="100%">
        <tr>
          <td class="headerItem" width="20%">Current&nbsp;view:</td>
          <td class="headerValue" width="80%" colspan=4><a href="../index.html">directory</a> - <a href="index.html">smart_ptr</a> - shared_ptr.hpp</td>
        </tr>
        <tr>
          <td class="headerItem" width="20%">Test:</td>
          <td class="headerValue" width="80%" colspan=4>ged.info</td>
        </tr>
        <tr>
          <td class="headerItem" width="20%">Date:</td>
          <td class="headerValue" width="20%">2009-06-09</td>
          <td width="20%"></td>
          <td class="headerItem" width="20%">Instrumented&nbsp;lines:</td>
          <td class="headerValue" width="20%">30</td>
        </tr>
        <tr>
          <td class="headerItem" width="20%">Code&nbsp;covered:</td>
          <td class="headerValue" width="20%">100.0 %</td>
          <td width="20%"></td>
          <td class="headerItem" width="20%">Executed&nbsp;lines:</td>
          <td class="headerValue" width="20%">30</td>
        </tr>
        </table>
      </td>
    </tr>
    <tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>
  </table>

  <table cellpadding=0 cellspacing=0 border=0>
    <tr>
      <td><br></td>
    </tr>
    <tr>
      <td><pre class="source">
<span class="lineNum">       1 </span>                : #ifndef BOOST_SMART_PTR_SHARED_PTR_HPP_INCLUDED
<span class="lineNum">       2 </span>                : #define BOOST_SMART_PTR_SHARED_PTR_HPP_INCLUDED
<span class="lineNum">       3 </span>                : 
<span class="lineNum">       4 </span>                : //
<span class="lineNum">       5 </span>                : //  shared_ptr.hpp
<span class="lineNum">       6 </span>                : //
<span class="lineNum">       7 </span>                : //  (C) Copyright Greg Colvin and Beman Dawes 1998, 1999.
<span class="lineNum">       8 </span>                : //  Copyright (c) 2001-2008 Peter Dimov
<span class="lineNum">       9 </span>                : //
<span class="lineNum">      10 </span>                : //  Distributed under the Boost Software License, Version 1.0. (See
<span class="lineNum">      11 </span>                : //  accompanying file LICENSE_1_0.txt or copy at
<span class="lineNum">      12 </span>                : //  http://www.boost.org/LICENSE_1_0.txt)
<span class="lineNum">      13 </span>                : //
<span class="lineNum">      14 </span>                : //  See http://www.boost.org/libs/smart_ptr/shared_ptr.htm for documentation.
<span class="lineNum">      15 </span>                : //
<span class="lineNum">      16 </span>                : 
<span class="lineNum">      17 </span>                : #include &lt;boost/config.hpp&gt;   // for broken compiler workarounds
<span class="lineNum">      18 </span>                : 
<span class="lineNum">      19 </span>                : #if defined(BOOST_NO_MEMBER_TEMPLATES) &amp;&amp; !defined(BOOST_MSVC6_MEMBER_TEMPLATES)
<span class="lineNum">      20 </span>                : #include &lt;boost/smart_ptr/detail/shared_ptr_nmt.hpp&gt;
<span class="lineNum">      21 </span>                : #else
<span class="lineNum">      22 </span>                : 
<span class="lineNum">      23 </span>                : // In order to avoid circular dependencies with Boost.TR1
<span class="lineNum">      24 </span>                : // we make sure that our include of &lt;memory&gt; doesn't try to
<span class="lineNum">      25 </span>                : // pull in the TR1 headers: that's why we use this header 
<span class="lineNum">      26 </span>                : // rather than including &lt;memory&gt; directly:
<span class="lineNum">      27 </span>                : #include &lt;boost/config/no_tr1/memory.hpp&gt;  // std::auto_ptr
<span class="lineNum">      28 </span>                : 
<span class="lineNum">      29 </span>                : #include &lt;boost/assert.hpp&gt;
<span class="lineNum">      30 </span>                : #include &lt;boost/checked_delete.hpp&gt;
<span class="lineNum">      31 </span>                : #include &lt;boost/throw_exception.hpp&gt;
<span class="lineNum">      32 </span>                : #include &lt;boost/smart_ptr/detail/shared_count.hpp&gt;
<span class="lineNum">      33 </span>                : #include &lt;boost/detail/workaround.hpp&gt;
<span class="lineNum">      34 </span>                : #include &lt;boost/smart_ptr/detail/sp_convertible.hpp&gt;
<span class="lineNum">      35 </span>                : 
<span class="lineNum">      36 </span>                : #if !defined(BOOST_SP_NO_ATOMIC_ACCESS)
<span class="lineNum">      37 </span>                : #include &lt;boost/smart_ptr/detail/spinlock_pool.hpp&gt;
<span class="lineNum">      38 </span>                : #include &lt;boost/memory_order.hpp&gt;
<span class="lineNum">      39 </span>                : #endif
<span class="lineNum">      40 </span>                : 
<span class="lineNum">      41 </span>                : #include &lt;algorithm&gt;            // for std::swap
<span class="lineNum">      42 </span>                : #include &lt;functional&gt;           // for std::less
<span class="lineNum">      43 </span>                : #include &lt;typeinfo&gt;             // for std::bad_cast
<span class="lineNum">      44 </span>                : 
<span class="lineNum">      45 </span>                : #if !defined(BOOST_NO_IOSTREAM)
<span class="lineNum">      46 </span>                : #if !defined(BOOST_NO_IOSFWD)
<span class="lineNum">      47 </span>                : #include &lt;iosfwd&gt;               // for std::basic_ostream
<span class="lineNum">      48 </span>                : #else
<span class="lineNum">      49 </span>                : #include &lt;ostream&gt;
<span class="lineNum">      50 </span>                : #endif
<span class="lineNum">      51 </span>                : #endif
<span class="lineNum">      52 </span>                : 
<span class="lineNum">      53 </span>                : #ifdef BOOST_MSVC  // moved here to work around VC++ compiler crash
<span class="lineNum">      54 </span>                : # pragma warning(push)
<span class="lineNum">      55 </span>                : # pragma warning(disable:4284) // odd return type for operator-&gt;
<span class="lineNum">      56 </span>                : #endif
<span class="lineNum">      57 </span>                : 
<span class="lineNum">      58 </span>                : namespace boost
<span class="lineNum">      59 </span>                : {
<span class="lineNum">      60 </span>                : 
<span class="lineNum">      61 </span>                : template&lt;class T&gt; class shared_ptr;
<span class="lineNum">      62 </span>                : template&lt;class T&gt; class weak_ptr;
<span class="lineNum">      63 </span>                : template&lt;class T&gt; class enable_shared_from_this;
<span class="lineNum">      64 </span>                : 
<span class="lineNum">      65 </span>                : namespace detail
<span class="lineNum">      66 </span>                : {
<span class="lineNum">      67 </span>                : 
<span class="lineNum">      68 </span>                : struct static_cast_tag {};
<span class="lineNum">      69 </span>                : struct const_cast_tag {};
<span class="lineNum">      70 </span>                : struct dynamic_cast_tag {};
<span class="lineNum">      71 </span>                : struct polymorphic_cast_tag {};
<span class="lineNum">      72 </span>                : 
<span class="lineNum">      73 </span>                : template&lt;class T&gt; struct shared_ptr_traits
<span class="lineNum">      74 </span>                : {
<span class="lineNum">      75 </span>                :     typedef T &amp; reference;
<span class="lineNum">      76 </span>                : };
<span class="lineNum">      77 </span>                : 
<span class="lineNum">      78 </span>                : template&lt;&gt; struct shared_ptr_traits&lt;void&gt;
<span class="lineNum">      79 </span>                : {
<span class="lineNum">      80 </span>                :     typedef void reference;
<span class="lineNum">      81 </span>                : };
<span class="lineNum">      82 </span>                : 
<span class="lineNum">      83 </span>                : #if !defined(BOOST_NO_CV_VOID_SPECIALIZATIONS)
<span class="lineNum">      84 </span>                : 
<span class="lineNum">      85 </span>                : template&lt;&gt; struct shared_ptr_traits&lt;void const&gt;
<span class="lineNum">      86 </span>                : {
<span class="lineNum">      87 </span>                :     typedef void reference;
<span class="lineNum">      88 </span>                : };
<span class="lineNum">      89 </span>                : 
<span class="lineNum">      90 </span>                : template&lt;&gt; struct shared_ptr_traits&lt;void volatile&gt;
<span class="lineNum">      91 </span>                : {
<span class="lineNum">      92 </span>                :     typedef void reference;
<span class="lineNum">      93 </span>                : };
<span class="lineNum">      94 </span>                : 
<span class="lineNum">      95 </span>                : template&lt;&gt; struct shared_ptr_traits&lt;void const volatile&gt;
<span class="lineNum">      96 </span>                : {
<span class="lineNum">      97 </span>                :     typedef void reference;
<span class="lineNum">      98 </span>                : };
<span class="lineNum">      99 </span>                : 
<span class="lineNum">     100 </span>                : #endif
<span class="lineNum">     101 </span>                : 
<span class="lineNum">     102 </span>                : // enable_shared_from_this support
<span class="lineNum">     103 </span>                : 
<span class="lineNum">     104 </span>                : template&lt; class X, class Y, class T &gt; inline void sp_enable_shared_from_this( boost::shared_ptr&lt;X&gt; const * ppx, Y const * py, boost::enable_shared_from_this&lt; T &gt; const * pe )
<span class="lineNum">     105 </span>                : {
<span class="lineNum">     106 </span>                :     if( pe != 0 )
<span class="lineNum">     107 </span>                :     {
<span class="lineNum">     108 </span>                :         pe-&gt;_internal_accept_owner( ppx, const_cast&lt; Y* &gt;( py ) );
<span class="lineNum">     109 </span>                :     }
<span class="lineNum">     110 </span>                : }
<span class="lineNum">     111 </span>                : 
<span class="lineNum">     112 </span>                : #ifdef _MANAGED
<span class="lineNum">     113 </span>                : 
<span class="lineNum">     114 </span>                : // Avoid C4793, ... causes native code generation
<span class="lineNum">     115 </span>                : 
<span class="lineNum">     116 </span>                : struct sp_any_pointer
<span class="lineNum">     117 </span>                : {
<span class="lineNum">     118 </span>                :     template&lt;class T&gt; sp_any_pointer( T* ) {}
<span class="lineNum">     119 </span>                : };
<span class="lineNum">     120 </span>                : 
<span class="lineNum">     121 </span>                : inline void sp_enable_shared_from_this( sp_any_pointer, sp_any_pointer, sp_any_pointer )
<span class="lineNum">     122 </span>                : {
<span class="lineNum">     123 </span>                : }
<span class="lineNum">     124 </span>                : 
<span class="lineNum">     125 </span>                : #else // _MANAGED
<span class="lineNum">     126 </span>                : 
<span class="lineNum">     127 </span><span class="lineCov">             94 : inline void sp_enable_shared_from_this( ... )</span>
<span class="lineNum">     128 </span>                : {
<span class="lineNum">     129 </span><span class="lineCov">             94 : }</span>
<span class="lineNum">     130 </span>                : 
<span class="lineNum">     131 </span>                : #endif // _MANAGED
<span class="lineNum">     132 </span>                : 
<span class="lineNum">     133 </span>                : #if !defined( BOOST_NO_SFINAE ) &amp;&amp; !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) &amp;&amp; !defined( BOOST_NO_AUTO_PTR )
<span class="lineNum">     134 </span>                : 
<span class="lineNum">     135 </span>                : // rvalue auto_ptr support based on a technique by Dave Abrahams
<span class="lineNum">     136 </span>                : 
<span class="lineNum">     137 </span>                : template&lt; class T, class R &gt; struct sp_enable_if_auto_ptr
<span class="lineNum">     138 </span>                : {
<span class="lineNum">     139 </span>                : };
<span class="lineNum">     140 </span>                : 
<span class="lineNum">     141 </span>                : template&lt; class T, class R &gt; struct sp_enable_if_auto_ptr&lt; std::auto_ptr&lt; T &gt;, R &gt;
<span class="lineNum">     142 </span>                : {
<span class="lineNum">     143 </span>                :     typedef R type;
<span class="lineNum">     144 </span>                : }; 
<span class="lineNum">     145 </span>                : 
<span class="lineNum">     146 </span>                : #endif
<span class="lineNum">     147 </span>                : 
<span class="lineNum">     148 </span>                : } // namespace detail
<span class="lineNum">     149 </span>                : 
<span class="lineNum">     150 </span>                : 
<span class="lineNum">     151 </span>                : //
<span class="lineNum">     152 </span>                : //  shared_ptr
<span class="lineNum">     153 </span>                : //
<span class="lineNum">     154 </span>                : //  An enhanced relative of scoped_ptr with reference counted copy semantics.
<span class="lineNum">     155 </span>                : //  The object pointed to is deleted when the last shared_ptr pointing to it
<span class="lineNum">     156 </span>                : //  is destroyed or reset.
<span class="lineNum">     157 </span>                : //
<span class="lineNum">     158 </span>                : 
<span class="lineNum">     159 </span>                : template&lt;class T&gt; class shared_ptr
<span class="lineNum">     160 </span><span class="lineCov">            763 : {</span>
<span class="lineNum">     161 </span>                : private:
<span class="lineNum">     162 </span>                : 
<span class="lineNum">     163 </span>                :     // Borland 5.5.1 specific workaround
<span class="lineNum">     164 </span>                :     typedef shared_ptr&lt;T&gt; this_type;
<span class="lineNum">     165 </span>                : 
<span class="lineNum">     166 </span>                : public:
<span class="lineNum">     167 </span>                : 
<span class="lineNum">     168 </span>                :     typedef T element_type;
<span class="lineNum">     169 </span>                :     typedef T value_type;
<span class="lineNum">     170 </span>                :     typedef T * pointer;
<span class="lineNum">     171 </span>                :     typedef typename boost::detail::shared_ptr_traits&lt;T&gt;::reference reference;
<span class="lineNum">     172 </span>                : 
<span class="lineNum">     173 </span><span class="lineCov">             58 :     shared_ptr(): px(0), pn() // never throws in 1.30+</span>
<span class="lineNum">     174 </span>                :     {
<span class="lineNum">     175 </span><span class="lineCov">             58 :     }</span>
<span class="lineNum">     176 </span>                : 
<span class="lineNum">     177 </span>                :     template&lt;class Y&gt;
<span class="lineNum">     178 </span><span class="lineCov">             85 :     explicit shared_ptr( Y * p ): px( p ), pn( p ) // Y must be complete</span>
<span class="lineNum">     179 </span>                :     {
<span class="lineNum">     180 </span><span class="lineCov">             85 :         boost::detail::sp_enable_shared_from_this( this, p, p );</span>
<span class="lineNum">     181 </span><span class="lineCov">             85 :     }</span>
<span class="lineNum">     182 </span>                : 
<span class="lineNum">     183 </span>                :     //
<span class="lineNum">     184 </span>                :     // Requirements: D's copy constructor must not throw
<span class="lineNum">     185 </span>                :     //
<span class="lineNum">     186 </span>                :     // shared_ptr will release p by calling d(p)
<span class="lineNum">     187 </span>                :     //
<span class="lineNum">     188 </span>                : 
<span class="lineNum">     189 </span><span class="lineCov">              6 :     template&lt;class Y, class D&gt; shared_ptr(Y * p, D d): px(p), pn(p, d)</span>
<span class="lineNum">     190 </span>                :     {
<span class="lineNum">     191 </span><span class="lineCov">              6 :         boost::detail::sp_enable_shared_from_this( this, p, p );</span>
<span class="lineNum">     192 </span><span class="lineCov">              6 :     }</span>
<span class="lineNum">     193 </span>                : 
<span class="lineNum">     194 </span>                :     // As above, but with allocator. A's copy constructor shall not throw.
<span class="lineNum">     195 </span>                : 
<span class="lineNum">     196 </span>                :     template&lt;class Y, class D, class A&gt; shared_ptr( Y * p, D d, A a ): px( p ), pn( p, d, a )
<span class="lineNum">     197 </span>                :     {
<span class="lineNum">     198 </span>                :         boost::detail::sp_enable_shared_from_this( this, p, p );
<span class="lineNum">     199 </span>                :     }
<span class="lineNum">     200 </span>                : 
<span class="lineNum">     201 </span>                : //  generated copy constructor, destructor are fine
<span class="lineNum">     202 </span>                : 
<span class="lineNum">     203 </span>                :     template&lt;class Y&gt;
<span class="lineNum">     204 </span>                :     explicit shared_ptr(weak_ptr&lt;Y&gt; const &amp; r): pn(r.pn) // may throw
<span class="lineNum">     205 </span>                :     {
<span class="lineNum">     206 </span>                :         // it is now safe to copy r.px, as pn(r.pn) did not throw
<span class="lineNum">     207 </span>                :         px = r.px;
<span class="lineNum">     208 </span>                :     }
<span class="lineNum">     209 </span>                : 
<span class="lineNum">     210 </span>                :     template&lt;class Y&gt;
<span class="lineNum">     211 </span>                :     shared_ptr( weak_ptr&lt;Y&gt; const &amp; r, boost::detail::sp_nothrow_tag ): px( 0 ), pn( r.pn, boost::detail::sp_nothrow_tag() ) // never throws
<span class="lineNum">     212 </span>                :     {
<span class="lineNum">     213 </span>                :         if( !pn.empty() )
<span class="lineNum">     214 </span>                :         {
<span class="lineNum">     215 </span>                :             px = r.px;
<span class="lineNum">     216 </span>                :         }
<span class="lineNum">     217 </span>                :     }
<span class="lineNum">     218 </span>                : 
<span class="lineNum">     219 </span>                :     template&lt;class Y&gt;
<span class="lineNum">     220 </span>                : #if !defined( BOOST_SP_NO_SP_CONVERTIBLE )
<span class="lineNum">     221 </span>                : 
<span class="lineNum">     222 </span>                :     shared_ptr( shared_ptr&lt;Y&gt; const &amp; r, typename detail::sp_enable_if_convertible&lt;Y,T&gt;::type = detail::sp_empty() )
<span class="lineNum">     223 </span>                : 
<span class="lineNum">     224 </span>                : #else
<span class="lineNum">     225 </span>                : 
<span class="lineNum">     226 </span>                :     shared_ptr( shared_ptr&lt;Y&gt; const &amp; r )
<span class="lineNum">     227 </span>                : 
<span class="lineNum">     228 </span>                : #endif
<span class="lineNum">     229 </span>                :     : px( r.px ), pn( r.pn ) // never throws
<span class="lineNum">     230 </span>                :     {
<span class="lineNum">     231 </span>                :     }
<span class="lineNum">     232 </span>                : 
<span class="lineNum">     233 </span>                :     // aliasing
<span class="lineNum">     234 </span>                :     template&lt; class Y &gt;
<span class="lineNum">     235 </span>                :     shared_ptr( shared_ptr&lt;Y&gt; const &amp; r, T * p ): px( p ), pn( r.pn ) // never throws
<span class="lineNum">     236 </span>                :     {
<span class="lineNum">     237 </span>                :     }
<span class="lineNum">     238 </span>                : 
<span class="lineNum">     239 </span>                :     template&lt;class Y&gt;
<span class="lineNum">     240 </span>                :     shared_ptr(shared_ptr&lt;Y&gt; const &amp; r, boost::detail::static_cast_tag): px(static_cast&lt;element_type *&gt;(r.px)), pn(r.pn)
<span class="lineNum">     241 </span>                :     {
<span class="lineNum">     242 </span>                :     }
<span class="lineNum">     243 </span>                : 
<span class="lineNum">     244 </span>                :     template&lt;class Y&gt;
<span class="lineNum">     245 </span>                :     shared_ptr(shared_ptr&lt;Y&gt; const &amp; r, boost::detail::const_cast_tag): px(const_cast&lt;element_type *&gt;(r.px)), pn(r.pn)
<span class="lineNum">     246 </span>                :     {
<span class="lineNum">     247 </span>                :     }
<span class="lineNum">     248 </span>                : 
<span class="lineNum">     249 </span>                :     template&lt;class Y&gt;
<span class="lineNum">     250 </span>                :     shared_ptr(shared_ptr&lt;Y&gt; const &amp; r, boost::detail::dynamic_cast_tag): px(dynamic_cast&lt;element_type *&gt;(r.px)), pn(r.pn)
<span class="lineNum">     251 </span>                :     {
<span class="lineNum">     252 </span>                :         if(px == 0) // need to allocate new counter -- the cast failed
<span class="lineNum">     253 </span>                :         {
<span class="lineNum">     254 </span>                :             pn = boost::detail::shared_count();
<span class="lineNum">     255 </span>                :         }
<span class="lineNum">     256 </span>                :     }
<span class="lineNum">     257 </span>                : 
<span class="lineNum">     258 </span>                :     template&lt;class Y&gt;
<span class="lineNum">     259 </span>                :     shared_ptr(shared_ptr&lt;Y&gt; const &amp; r, boost::detail::polymorphic_cast_tag): px(dynamic_cast&lt;element_type *&gt;(r.px)), pn(r.pn)
<span class="lineNum">     260 </span>                :     {
<span class="lineNum">     261 </span>                :         if(px == 0)
<span class="lineNum">     262 </span>                :         {
<span class="lineNum">     263 </span>                :             boost::throw_exception(std::bad_cast());
<span class="lineNum">     264 </span>                :         }
<span class="lineNum">     265 </span>                :     }
<span class="lineNum">     266 </span>                : 
<span class="lineNum">     267 </span>                : #ifndef BOOST_NO_AUTO_PTR
<span class="lineNum">     268 </span>                : 
<span class="lineNum">     269 </span>                :     template&lt;class Y&gt;
<span class="lineNum">     270 </span>                :     explicit shared_ptr(std::auto_ptr&lt;Y&gt; &amp; r): px(r.get()), pn()
<span class="lineNum">     271 </span>                :     {
<span class="lineNum">     272 </span>                :         Y * tmp = r.get();
<span class="lineNum">     273 </span>                :         pn = boost::detail::shared_count(r);
<span class="lineNum">     274 </span>                :         boost::detail::sp_enable_shared_from_this( this, tmp, tmp );
<span class="lineNum">     275 </span>                :     }
<span class="lineNum">     276 </span>                : 
<span class="lineNum">     277 </span>                : #if !defined( BOOST_NO_SFINAE ) &amp;&amp; !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION )
<span class="lineNum">     278 </span>                : 
<span class="lineNum">     279 </span>                :     template&lt;class Ap&gt;
<span class="lineNum">     280 </span>                :     explicit shared_ptr( Ap r, typename boost::detail::sp_enable_if_auto_ptr&lt;Ap, int&gt;::type = 0 ): px( r.get() ), pn()
<span class="lineNum">     281 </span>                :     {
<span class="lineNum">     282 </span>                :         typename Ap::element_type * tmp = r.get();
<span class="lineNum">     283 </span>                :         pn = boost::detail::shared_count( r );
<span class="lineNum">     284 </span>                :         boost::detail::sp_enable_shared_from_this( this, tmp, tmp );
<span class="lineNum">     285 </span>                :     }
<span class="lineNum">     286 </span>                : 
<span class="lineNum">     287 </span>                : 
<span class="lineNum">     288 </span>                : #endif // BOOST_NO_SFINAE, BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
<span class="lineNum">     289 </span>                : 
<span class="lineNum">     290 </span>                : #endif // BOOST_NO_AUTO_PTR
<span class="lineNum">     291 </span>                : 
<span class="lineNum">     292 </span>                :     // assignment
<span class="lineNum">     293 </span>                : 
<span class="lineNum">     294 </span><span class="lineCov">              8 :     shared_ptr &amp; operator=( shared_ptr const &amp; r ) // never throws</span>
<span class="lineNum">     295 </span>                :     {
<span class="lineNum">     296 </span><span class="lineCov">              8 :         this_type(r).swap(*this);</span>
<span class="lineNum">     297 </span><span class="lineCov">              8 :         return *this;</span>
<span class="lineNum">     298 </span>                :     }
<span class="lineNum">     299 </span>                : 
<span class="lineNum">     300 </span>                : #if !defined(BOOST_MSVC) || (BOOST_MSVC &gt;= 1400)
<span class="lineNum">     301 </span>                : 
<span class="lineNum">     302 </span>                :     template&lt;class Y&gt;
<span class="lineNum">     303 </span>                :     shared_ptr &amp; operator=(shared_ptr&lt;Y&gt; const &amp; r) // never throws
<span class="lineNum">     304 </span>                :     {
<span class="lineNum">     305 </span>                :         this_type(r).swap(*this);
<span class="lineNum">     306 </span>                :         return *this;
<span class="lineNum">     307 </span>                :     }
<span class="lineNum">     308 </span>                : 
<span class="lineNum">     309 </span>                : #endif
<span class="lineNum">     310 </span>                : 
<span class="lineNum">     311 </span>                : #ifndef BOOST_NO_AUTO_PTR
<span class="lineNum">     312 </span>                : 
<span class="lineNum">     313 </span>                :     template&lt;class Y&gt;
<span class="lineNum">     314 </span>                :     shared_ptr &amp; operator=( std::auto_ptr&lt;Y&gt; &amp; r )
<span class="lineNum">     315 </span>                :     {
<span class="lineNum">     316 </span>                :         this_type(r).swap(*this);
<span class="lineNum">     317 </span>                :         return *this;
<span class="lineNum">     318 </span>                :     }
<span class="lineNum">     319 </span>                : 
<span class="lineNum">     320 </span>                : #if !defined( BOOST_NO_SFINAE ) &amp;&amp; !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION )
<span class="lineNum">     321 </span>                : 
<span class="lineNum">     322 </span>                :     template&lt;class Ap&gt;
<span class="lineNum">     323 </span>                :     typename boost::detail::sp_enable_if_auto_ptr&lt; Ap, shared_ptr &amp; &gt;::type operator=( Ap r )
<span class="lineNum">     324 </span>                :     {
<span class="lineNum">     325 </span>                :         this_type( r ).swap( *this );
<span class="lineNum">     326 </span>                :         return *this;
<span class="lineNum">     327 </span>                :     }
<span class="lineNum">     328 </span>                : 
<span class="lineNum">     329 </span>                : 
<span class="lineNum">     330 </span>                : #endif // BOOST_NO_SFINAE, BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
<span class="lineNum">     331 </span>                : 
<span class="lineNum">     332 </span>                : #endif // BOOST_NO_AUTO_PTR
<span class="lineNum">     333 </span>                : 
<span class="lineNum">     334 </span>                : // Move support
<span class="lineNum">     335 </span>                : 
<span class="lineNum">     336 </span>                : #if defined( BOOST_HAS_RVALUE_REFS )
<span class="lineNum">     337 </span>                : 
<span class="lineNum">     338 </span>                :     shared_ptr( shared_ptr &amp;&amp; r ): px( r.px ), pn() // never throws
<span class="lineNum">     339 </span>                :     {
<span class="lineNum">     340 </span>                :         pn.swap( r.pn );
<span class="lineNum">     341 </span>                :         r.px = 0;
<span class="lineNum">     342 </span>                :     }
<span class="lineNum">     343 </span>                : 
<span class="lineNum">     344 </span>                :     template&lt;class Y&gt;
<span class="lineNum">     345 </span>                : #if !defined( BOOST_SP_NO_SP_CONVERTIBLE )
<span class="lineNum">     346 </span>                : 
<span class="lineNum">     347 </span>                :     shared_ptr( shared_ptr&lt;Y&gt; &amp;&amp; r, typename detail::sp_enable_if_convertible&lt;Y,T&gt;::type = detail::sp_empty() )
<span class="lineNum">     348 </span>                : 
<span class="lineNum">     349 </span>                : #else
<span class="lineNum">     350 </span>                : 
<span class="lineNum">     351 </span>                :     shared_ptr( shared_ptr&lt;Y&gt; &amp;&amp; r )
<span class="lineNum">     352 </span>                : 
<span class="lineNum">     353 </span>                : #endif
<span class="lineNum">     354 </span>                :     : px( r.px ), pn() // never throws
<span class="lineNum">     355 </span>                :     {
<span class="lineNum">     356 </span>                :         pn.swap( r.pn );
<span class="lineNum">     357 </span>                :         r.px = 0;
<span class="lineNum">     358 </span>                :     }
<span class="lineNum">     359 </span>                : 
<span class="lineNum">     360 </span>                :     shared_ptr &amp; operator=( shared_ptr &amp;&amp; r ) // never throws
<span class="lineNum">     361 </span>                :     {
<span class="lineNum">     362 </span>                :         this_type( static_cast&lt; shared_ptr &amp;&amp; &gt;( r ) ).swap( *this );
<span class="lineNum">     363 </span>                :         return *this;
<span class="lineNum">     364 </span>                :     }
<span class="lineNum">     365 </span>                : 
<span class="lineNum">     366 </span>                :     template&lt;class Y&gt;
<span class="lineNum">     367 </span>                :     shared_ptr &amp; operator=( shared_ptr&lt;Y&gt; &amp;&amp; r ) // never throws
<span class="lineNum">     368 </span>                :     {
<span class="lineNum">     369 </span>                :         this_type( static_cast&lt; shared_ptr&lt;Y&gt; &amp;&amp; &gt;( r ) ).swap( *this );
<span class="lineNum">     370 </span>                :         return *this;
<span class="lineNum">     371 </span>                :     }
<span class="lineNum">     372 </span>                : 
<span class="lineNum">     373 </span>                : #endif
<span class="lineNum">     374 </span>                : 
<span class="lineNum">     375 </span>                :     void reset() // never throws in 1.30+
<span class="lineNum">     376 </span>                :     {
<span class="lineNum">     377 </span>                :         this_type().swap(*this);
<span class="lineNum">     378 </span>                :     }
<span class="lineNum">     379 </span>                : 
<span class="lineNum">     380 </span><span class="lineCov">             20 :     template&lt;class Y&gt; void reset(Y * p) // Y must be complete</span>
<span class="lineNum">     381 </span>                :     {
<span class="lineNum">     382 </span><span class="lineCov">             20 :         BOOST_ASSERT(p == 0 || p != px); // catch self-reset errors</span>
<span class="lineNum">     383 </span><span class="lineCov">             20 :         this_type(p).swap(*this);</span>
<span class="lineNum">     384 </span><span class="lineCov">             20 :     }</span>
<span class="lineNum">     385 </span>                : 
<span class="lineNum">     386 </span>                :     template&lt;class Y, class D&gt; void reset( Y * p, D d )
<span class="lineNum">     387 </span>                :     {
<span class="lineNum">     388 </span>                :         this_type( p, d ).swap( *this );
<span class="lineNum">     389 </span>                :     }
<span class="lineNum">     390 </span>                : 
<span class="lineNum">     391 </span>                :     template&lt;class Y, class D, class A&gt; void reset( Y * p, D d, A a )
<span class="lineNum">     392 </span>                :     {
<span class="lineNum">     393 </span>                :         this_type( p, d, a ).swap( *this );
<span class="lineNum">     394 </span>                :     }
<span class="lineNum">     395 </span>                : 
<span class="lineNum">     396 </span>                :     template&lt;class Y&gt; void reset( shared_ptr&lt;Y&gt; const &amp; r, T * p )
<span class="lineNum">     397 </span>                :     {
<span class="lineNum">     398 </span>                :         this_type( r, p ).swap( *this );
<span class="lineNum">     399 </span>                :     }
<span class="lineNum">     400 </span>                : 
<span class="lineNum">     401 </span><span class="lineCov">             24 :     reference operator* () const // never throws</span>
<span class="lineNum">     402 </span>                :     {
<span class="lineNum">     403 </span><span class="lineCov">             24 :         BOOST_ASSERT(px != 0);</span>
<span class="lineNum">     404 </span><span class="lineCov">             24 :         return *px;</span>
<span class="lineNum">     405 </span>                :     }
<span class="lineNum">     406 </span>                : 
<span class="lineNum">     407 </span><span class="lineCov">            194 :     T * operator-&gt; () const // never throws</span>
<span class="lineNum">     408 </span>                :     {
<span class="lineNum">     409 </span><span class="lineCov">            194 :         BOOST_ASSERT(px != 0);</span>
<span class="lineNum">     410 </span><span class="lineCov">            194 :         return px;</span>
<span class="lineNum">     411 </span>                :     }
<span class="lineNum">     412 </span>                : 
<span class="lineNum">     413 </span><span class="lineCov">              6 :     T * get() const // never throws</span>
<span class="lineNum">     414 </span>                :     {
<span class="lineNum">     415 </span><span class="lineCov">              6 :         return px;</span>
<span class="lineNum">     416 </span>                :     }
<span class="lineNum">     417 </span>                : 
<span class="lineNum">     418 </span>                : // implicit conversion to &quot;bool&quot;
<span class="lineNum">     419 </span>                : #include &lt;boost/smart_ptr/detail/operator_bool.hpp&gt;
<span class="lineNum">     420 </span>                : 
<span class="lineNum">     421 </span>                :     bool unique() const // never throws
<span class="lineNum">     422 </span>                :     {
<span class="lineNum">     423 </span>                :         return pn.unique();
<span class="lineNum">     424 </span>                :     }
<span class="lineNum">     425 </span>                : 
<span class="lineNum">     426 </span>                :     long use_count() const // never throws
<span class="lineNum">     427 </span>                :     {
<span class="lineNum">     428 </span>                :         return pn.use_count();
<span class="lineNum">     429 </span>                :     }
<span class="lineNum">     430 </span>                : 
<span class="lineNum">     431 </span><span class="lineCov">             28 :     void swap(shared_ptr&lt;T&gt; &amp; other) // never throws</span>
<span class="lineNum">     432 </span>                :     {
<span class="lineNum">     433 </span><span class="lineCov">             28 :         std::swap(px, other.px);</span>
<span class="lineNum">     434 </span><span class="lineCov">             28 :         pn.swap(other.pn);</span>
<span class="lineNum">     435 </span><span class="lineCov">             28 :     }</span>
<span class="lineNum">     436 </span>                : 
<span class="lineNum">     437 </span>                :     template&lt;class Y&gt; bool _internal_less(shared_ptr&lt;Y&gt; const &amp; rhs) const
<span class="lineNum">     438 </span>                :     {
<span class="lineNum">     439 </span>                :         return pn &lt; rhs.pn;
<span class="lineNum">     440 </span>                :     }
<span class="lineNum">     441 </span>                : 
<span class="lineNum">     442 </span>                :     void * _internal_get_deleter( detail::sp_typeinfo const &amp; ti ) const
<span class="lineNum">     443 </span>                :     {
<span class="lineNum">     444 </span>                :         return pn.get_deleter( ti );
<span class="lineNum">     445 </span>                :     }
<span class="lineNum">     446 </span>                : 
<span class="lineNum">     447 </span>                :     bool _internal_equiv( shared_ptr const &amp; r ) const
<span class="lineNum">     448 </span>                :     {
<span class="lineNum">     449 </span>                :         return px == r.px &amp;&amp; pn == r.pn;
<span class="lineNum">     450 </span>                :     }
<span class="lineNum">     451 </span>                : 
<span class="lineNum">     452 </span>                : // Tasteless as this may seem, making all members public allows member templates
<span class="lineNum">     453 </span>                : // to work in the absence of member template friends. (Matthew Langston)
<span class="lineNum">     454 </span>                : 
<span class="lineNum">     455 </span>                : #ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
<span class="lineNum">     456 </span>                : 
<span class="lineNum">     457 </span>                : private:
<span class="lineNum">     458 </span>                : 
<span class="lineNum">     459 </span>                :     template&lt;class Y&gt; friend class shared_ptr;
<span class="lineNum">     460 </span>                :     template&lt;class Y&gt; friend class weak_ptr;
<span class="lineNum">     461 </span>                : 
<span class="lineNum">     462 </span>                : 
<span class="lineNum">     463 </span>                : #endif
<span class="lineNum">     464 </span>                : 
<span class="lineNum">     465 </span>                :     T * px;                     // contained pointer
<span class="lineNum">     466 </span>                :     boost::detail::shared_count pn;    // reference counter
<span class="lineNum">     467 </span>                : 
<span class="lineNum">     468 </span>                : };  // shared_ptr
<span class="lineNum">     469 </span>                : 
<span class="lineNum">     470 </span>                : template&lt;class T, class U&gt; inline bool operator==(shared_ptr&lt;T&gt; const &amp; a, shared_ptr&lt;U&gt; const &amp; b)
<span class="lineNum">     471 </span>                : {
<span class="lineNum">     472 </span>                :     return a.get() == b.get();
<span class="lineNum">     473 </span>                : }
<span class="lineNum">     474 </span>                : 
<span class="lineNum">     475 </span>                : template&lt;class T, class U&gt; inline bool operator!=(shared_ptr&lt;T&gt; const &amp; a, shared_ptr&lt;U&gt; const &amp; b)
<span class="lineNum">     476 </span>                : {
<span class="lineNum">     477 </span>                :     return a.get() != b.get();
<span class="lineNum">     478 </span>                : }
<span class="lineNum">     479 </span>                : 
<span class="lineNum">     480 </span>                : #if __GNUC__ == 2 &amp;&amp; __GNUC_MINOR__ &lt;= 96
<span class="lineNum">     481 </span>                : 
<span class="lineNum">     482 </span>                : // Resolve the ambiguity between our op!= and the one in rel_ops
<span class="lineNum">     483 </span>                : 
<span class="lineNum">     484 </span>                : template&lt;class T&gt; inline bool operator!=(shared_ptr&lt;T&gt; const &amp; a, shared_ptr&lt;T&gt; const &amp; b)
<span class="lineNum">     485 </span>                : {
<span class="lineNum">     486 </span>                :     return a.get() != b.get();
<span class="lineNum">     487 </span>                : }
<span class="lineNum">     488 </span>                : 
<span class="lineNum">     489 </span>                : #endif
<span class="lineNum">     490 </span>                : 
<span class="lineNum">     491 </span>                : template&lt;class T, class U&gt; inline bool operator&lt;(shared_ptr&lt;T&gt; const &amp; a, shared_ptr&lt;U&gt; const &amp; b)
<span class="lineNum">     492 </span>                : {
<span class="lineNum">     493 </span>                :     return a._internal_less(b);
<span class="lineNum">     494 </span>                : }
<span class="lineNum">     495 </span>                : 
<span class="lineNum">     496 </span>                : template&lt;class T&gt; inline void swap(shared_ptr&lt;T&gt; &amp; a, shared_ptr&lt;T&gt; &amp; b)
<span class="lineNum">     497 </span>                : {
<span class="lineNum">     498 </span>                :     a.swap(b);
<span class="lineNum">     499 </span>                : }
<span class="lineNum">     500 </span>                : 
<span class="lineNum">     501 </span>                : template&lt;class T, class U&gt; shared_ptr&lt;T&gt; static_pointer_cast(shared_ptr&lt;U&gt; const &amp; r)
<span class="lineNum">     502 </span>                : {
<span class="lineNum">     503 </span>                :     return shared_ptr&lt;T&gt;(r, boost::detail::static_cast_tag());
<span class="lineNum">     504 </span>                : }
<span class="lineNum">     505 </span>                : 
<span class="lineNum">     506 </span>                : template&lt;class T, class U&gt; shared_ptr&lt;T&gt; const_pointer_cast(shared_ptr&lt;U&gt; const &amp; r)
<span class="lineNum">     507 </span>                : {
<span class="lineNum">     508 </span>                :     return shared_ptr&lt;T&gt;(r, boost::detail::const_cast_tag());
<span class="lineNum">     509 </span>                : }
<span class="lineNum">     510 </span>                : 
<span class="lineNum">     511 </span>                : template&lt;class T, class U&gt; shared_ptr&lt;T&gt; dynamic_pointer_cast(shared_ptr&lt;U&gt; const &amp; r)
<span class="lineNum">     512 </span>                : {
<span class="lineNum">     513 </span>                :     return shared_ptr&lt;T&gt;(r, boost::detail::dynamic_cast_tag());
<span class="lineNum">     514 </span>                : }
<span class="lineNum">     515 </span>                : 
<span class="lineNum">     516 </span>                : // shared_*_cast names are deprecated. Use *_pointer_cast instead.
<span class="lineNum">     517 </span>                : 
<span class="lineNum">     518 </span>                : template&lt;class T, class U&gt; shared_ptr&lt;T&gt; shared_static_cast(shared_ptr&lt;U&gt; const &amp; r)
<span class="lineNum">     519 </span>                : {
<span class="lineNum">     520 </span>                :     return shared_ptr&lt;T&gt;(r, boost::detail::static_cast_tag());
<span class="lineNum">     521 </span>                : }
<span class="lineNum">     522 </span>                : 
<span class="lineNum">     523 </span>                : template&lt;class T, class U&gt; shared_ptr&lt;T&gt; shared_dynamic_cast(shared_ptr&lt;U&gt; const &amp; r)
<span class="lineNum">     524 </span>                : {
<span class="lineNum">     525 </span>                :     return shared_ptr&lt;T&gt;(r, boost::detail::dynamic_cast_tag());
<span class="lineNum">     526 </span>                : }
<span class="lineNum">     527 </span>                : 
<span class="lineNum">     528 </span>                : template&lt;class T, class U&gt; shared_ptr&lt;T&gt; shared_polymorphic_cast(shared_ptr&lt;U&gt; const &amp; r)
<span class="lineNum">     529 </span>                : {
<span class="lineNum">     530 </span>                :     return shared_ptr&lt;T&gt;(r, boost::detail::polymorphic_cast_tag());
<span class="lineNum">     531 </span>                : }
<span class="lineNum">     532 </span>                : 
<span class="lineNum">     533 </span>                : template&lt;class T, class U&gt; shared_ptr&lt;T&gt; shared_polymorphic_downcast(shared_ptr&lt;U&gt; const &amp; r)
<span class="lineNum">     534 </span>                : {
<span class="lineNum">     535 </span>                :     BOOST_ASSERT(dynamic_cast&lt;T *&gt;(r.get()) == r.get());
<span class="lineNum">     536 </span>                :     return shared_static_cast&lt;T&gt;(r);
<span class="lineNum">     537 </span>                : }
<span class="lineNum">     538 </span>                : 
<span class="lineNum">     539 </span>                : // get_pointer() enables boost::mem_fn to recognize shared_ptr
<span class="lineNum">     540 </span>                : 
<span class="lineNum">     541 </span>                : template&lt;class T&gt; inline T * get_pointer(shared_ptr&lt;T&gt; const &amp; p)
<span class="lineNum">     542 </span>                : {
<span class="lineNum">     543 </span>                :     return p.get();
<span class="lineNum">     544 </span>                : }
<span class="lineNum">     545 </span>                : 
<span class="lineNum">     546 </span>                : // operator&lt;&lt;
<span class="lineNum">     547 </span>                : 
<span class="lineNum">     548 </span>                : #if !defined(BOOST_NO_IOSTREAM)
<span class="lineNum">     549 </span>                : 
<span class="lineNum">     550 </span>                : #if defined(BOOST_NO_TEMPLATED_IOSTREAMS) || ( defined(__GNUC__) &amp;&amp;  (__GNUC__ &lt; 3) )
<span class="lineNum">     551 </span>                : 
<span class="lineNum">     552 </span>                : template&lt;class Y&gt; std::ostream &amp; operator&lt;&lt; (std::ostream &amp; os, shared_ptr&lt;Y&gt; const &amp; p)
<span class="lineNum">     553 </span>                : {
<span class="lineNum">     554 </span>                :     os &lt;&lt; p.get();
<span class="lineNum">     555 </span>                :     return os;
<span class="lineNum">     556 </span>                : }
<span class="lineNum">     557 </span>                : 
<span class="lineNum">     558 </span>                : #else
<span class="lineNum">     559 </span>                : 
<span class="lineNum">     560 </span>                : // in STLport's no-iostreams mode no iostream symbols can be used
<span class="lineNum">     561 </span>                : #ifndef _STLP_NO_IOSTREAMS
<span class="lineNum">     562 </span>                : 
<span class="lineNum">     563 </span>                : # if defined(BOOST_MSVC) &amp;&amp; BOOST_WORKAROUND(BOOST_MSVC, &lt; 1300 &amp;&amp; __SGI_STL_PORT)
<span class="lineNum">     564 </span>                : // MSVC6 has problems finding std::basic_ostream through the using declaration in namespace _STL
<span class="lineNum">     565 </span>                : using std::basic_ostream;
<span class="lineNum">     566 </span>                : template&lt;class E, class T, class Y&gt; basic_ostream&lt;E, T&gt; &amp; operator&lt;&lt; (basic_ostream&lt;E, T&gt; &amp; os, shared_ptr&lt;Y&gt; const &amp; p)
<span class="lineNum">     567 </span>                : # else
<span class="lineNum">     568 </span>                : template&lt;class E, class T, class Y&gt; std::basic_ostream&lt;E, T&gt; &amp; operator&lt;&lt; (std::basic_ostream&lt;E, T&gt; &amp; os, shared_ptr&lt;Y&gt; const &amp; p)
<span class="lineNum">     569 </span>                : # endif
<span class="lineNum">     570 </span>                : {
<span class="lineNum">     571 </span>                :     os &lt;&lt; p.get();
<span class="lineNum">     572 </span>                :     return os;
<span class="lineNum">     573 </span>                : }
<span class="lineNum">     574 </span>                : 
<span class="lineNum">     575 </span>                : #endif // _STLP_NO_IOSTREAMS
<span class="lineNum">     576 </span>                : 
<span class="lineNum">     577 </span>                : #endif // __GNUC__ &lt; 3
<span class="lineNum">     578 </span>                : 
<span class="lineNum">     579 </span>                : #endif // !defined(BOOST_NO_IOSTREAM)
<span class="lineNum">     580 </span>                : 
<span class="lineNum">     581 </span>                : // get_deleter
<span class="lineNum">     582 </span>                : 
<span class="lineNum">     583 </span>                : #if ( defined(__GNUC__) &amp;&amp; BOOST_WORKAROUND(__GNUC__, &lt; 3) ) || \
<span class="lineNum">     584 </span>                :     ( defined(__EDG_VERSION__) &amp;&amp; BOOST_WORKAROUND(__EDG_VERSION__, &lt;= 238) ) || \
<span class="lineNum">     585 </span>                :     ( defined(__HP_aCC) &amp;&amp; BOOST_WORKAROUND(__HP_aCC, &lt;= 33500) )
<span class="lineNum">     586 </span>                : 
<span class="lineNum">     587 </span>                : // g++ 2.9x doesn't allow static_cast&lt;X const *&gt;(void *)
<span class="lineNum">     588 </span>                : // apparently EDG 2.38 and HP aCC A.03.35 also don't accept it
<span class="lineNum">     589 </span>                : 
<span class="lineNum">     590 </span>                : template&lt;class D, class T&gt; D * get_deleter(shared_ptr&lt;T&gt; const &amp; p)
<span class="lineNum">     591 </span>                : {
<span class="lineNum">     592 </span>                :     void const * q = p._internal_get_deleter(BOOST_SP_TYPEID(D));
<span class="lineNum">     593 </span>                :     return const_cast&lt;D *&gt;(static_cast&lt;D const *&gt;(q));
<span class="lineNum">     594 </span>                : }
<span class="lineNum">     595 </span>                : 
<span class="lineNum">     596 </span>                : #else
<span class="lineNum">     597 </span>                : 
<span class="lineNum">     598 </span>                : template&lt;class D, class T&gt; D * get_deleter(shared_ptr&lt;T&gt; const &amp; p)
<span class="lineNum">     599 </span>                : {
<span class="lineNum">     600 </span>                :     return static_cast&lt;D *&gt;(p._internal_get_deleter(BOOST_SP_TYPEID(D)));
<span class="lineNum">     601 </span>                : }
<span class="lineNum">     602 </span>                : 
<span class="lineNum">     603 </span>                : #endif
<span class="lineNum">     604 </span>                : 
<span class="lineNum">     605 </span>                : // atomic access
<span class="lineNum">     606 </span>                : 
<span class="lineNum">     607 </span>                : #if !defined(BOOST_SP_NO_ATOMIC_ACCESS)
<span class="lineNum">     608 </span>                : 
<span class="lineNum">     609 </span>                : template&lt;class T&gt; inline bool atomic_is_lock_free( shared_ptr&lt;T&gt; const * /*p*/ )
<span class="lineNum">     610 </span>                : {
<span class="lineNum">     611 </span>                :     return false;
<span class="lineNum">     612 </span>                : }
<span class="lineNum">     613 </span>                : 
<span class="lineNum">     614 </span>                : template&lt;class T&gt; shared_ptr&lt;T&gt; atomic_load( shared_ptr&lt;T&gt; const * p )
<span class="lineNum">     615 </span>                : {
<span class="lineNum">     616 </span>                :     boost::detail::spinlock_pool&lt;2&gt;::scoped_lock lock( p );
<span class="lineNum">     617 </span>                :     return *p;
<span class="lineNum">     618 </span>                : }
<span class="lineNum">     619 </span>                : 
<span class="lineNum">     620 </span>                : template&lt;class T&gt; inline shared_ptr&lt;T&gt; atomic_load_explicit( shared_ptr&lt;T&gt; const * p, memory_order /*mo*/ )
<span class="lineNum">     621 </span>                : {
<span class="lineNum">     622 </span>                :     return atomic_load( p );
<span class="lineNum">     623 </span>                : }
<span class="lineNum">     624 </span>                : 
<span class="lineNum">     625 </span>                : template&lt;class T&gt; void atomic_store( shared_ptr&lt;T&gt; * p, shared_ptr&lt;T&gt; r )
<span class="lineNum">     626 </span>                : {
<span class="lineNum">     627 </span>                :     boost::detail::spinlock_pool&lt;2&gt;::scoped_lock lock( p );
<span class="lineNum">     628 </span>                :     p-&gt;swap( r );
<span class="lineNum">     629 </span>                : }
<span class="lineNum">     630 </span>                : 
<span class="lineNum">     631 </span>                : template&lt;class T&gt; inline void atomic_store_explicit( shared_ptr&lt;T&gt; * p, shared_ptr&lt;T&gt; r, memory_order /*mo*/ )
<span class="lineNum">     632 </span>                : {
<span class="lineNum">     633 </span>                :     atomic_store( p, r ); // std::move( r )
<span class="lineNum">     634 </span>                : }
<span class="lineNum">     635 </span>                : 
<span class="lineNum">     636 </span>                : template&lt;class T&gt; shared_ptr&lt;T&gt; atomic_exchange( shared_ptr&lt;T&gt; * p, shared_ptr&lt;T&gt; r )
<span class="lineNum">     637 </span>                : {
<span class="lineNum">     638 </span>                :     boost::detail::spinlock &amp; sp = boost::detail::spinlock_pool&lt;2&gt;::spinlock_for( p );
<span class="lineNum">     639 </span>                : 
<span class="lineNum">     640 </span>                :     sp.lock();
<span class="lineNum">     641 </span>                :     p-&gt;swap( r );
<span class="lineNum">     642 </span>                :     sp.unlock();
<span class="lineNum">     643 </span>                : 
<span class="lineNum">     644 </span>                :     return r; // return std::move( r )
<span class="lineNum">     645 </span>                : }
<span class="lineNum">     646 </span>                : 
<span class="lineNum">     647 </span>                : template&lt;class T&gt; shared_ptr&lt;T&gt; atomic_exchange_explicit( shared_ptr&lt;T&gt; * p, shared_ptr&lt;T&gt; r, memory_order /*mo*/ )
<span class="lineNum">     648 </span>                : {
<span class="lineNum">     649 </span>                :     return atomic_exchange( p, r ); // std::move( r )
<span class="lineNum">     650 </span>                : }
<span class="lineNum">     651 </span>                : 
<span class="lineNum">     652 </span>                : template&lt;class T&gt; bool atomic_compare_exchange( shared_ptr&lt;T&gt; * p, shared_ptr&lt;T&gt; * v, shared_ptr&lt;T&gt; w )
<span class="lineNum">     653 </span>                : {
<span class="lineNum">     654 </span>                :     boost::detail::spinlock &amp; sp = boost::detail::spinlock_pool&lt;2&gt;::spinlock_for( p );
<span class="lineNum">     655 </span>                : 
<span class="lineNum">     656 </span>                :     sp.lock();
<span class="lineNum">     657 </span>                : 
<span class="lineNum">     658 </span>                :     if( p-&gt;_internal_equiv( *v ) )
<span class="lineNum">     659 </span>                :     {
<span class="lineNum">     660 </span>                :         p-&gt;swap( w );
<span class="lineNum">     661 </span>                : 
<span class="lineNum">     662 </span>                :         sp.unlock();
<span class="lineNum">     663 </span>                : 
<span class="lineNum">     664 </span>                :         return true;
<span class="lineNum">     665 </span>                :     }
<span class="lineNum">     666 </span>                :     else
<span class="lineNum">     667 </span>                :     {
<span class="lineNum">     668 </span>                :         shared_ptr&lt;T&gt; tmp( *p );
<span class="lineNum">     669 </span>                : 
<span class="lineNum">     670 </span>                :         sp.unlock();
<span class="lineNum">     671 </span>                : 
<span class="lineNum">     672 </span>                :         tmp.swap( *v );
<span class="lineNum">     673 </span>                :         return false;
<span class="lineNum">     674 </span>                :     }
<span class="lineNum">     675 </span>                : }
<span class="lineNum">     676 </span>                : 
<span class="lineNum">     677 </span>                : template&lt;class T&gt; inline bool atomic_compare_exchange_explicit( shared_ptr&lt;T&gt; * p, shared_ptr&lt;T&gt; * v, shared_ptr&lt;T&gt; w, memory_order /*success*/, memory_order /*failure*/ )
<span class="lineNum">     678 </span>                : {
<span class="lineNum">     679 </span>                :     return atomic_compare_exchange( p, v, w ); // std::move( w )
<span class="lineNum">     680 </span>                : }
<span class="lineNum">     681 </span>                : 
<span class="lineNum">     682 </span>                : #endif
<span class="lineNum">     683 </span>                : 
<span class="lineNum">     684 </span>                : } // namespace boost
<span class="lineNum">     685 </span>                : 
<span class="lineNum">     686 </span>                : #ifdef BOOST_MSVC
<span class="lineNum">     687 </span>                : # pragma warning(pop)
<span class="lineNum">     688 </span>                : #endif
<span class="lineNum">     689 </span>                : 
<span class="lineNum">     690 </span>                : #endif  // #if defined(BOOST_NO_MEMBER_TEMPLATES) &amp;&amp; !defined(BOOST_MSVC6_MEMBER_TEMPLATES)
<span class="lineNum">     691 </span>                : 
<span class="lineNum">     692 </span>                : #endif  // #ifndef BOOST_SMART_PTR_SHARED_PTR_HPP_INCLUDED
</pre>
      </td>
    </tr>
  </table>
  <br>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
  <tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>
  <tr><td class="versionInfo">Generated by: <a href="http://ltp.sourceforge.net/coverage/lcov.php" target="_parent">LTP GCOV extension version 1.6</a></td></tr>
  </table>
  <br>

</body>
</html>
